package com.hqyj.dao;

import com.hqyj.pojo.Resultinfo;
import com.hqyj.pojo.UserSerInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserSerInfoDao {
    @Select("select * from userserinfo , resultinfo where resultSerId=serId and serManager=#{serManager}")
    List<Resultinfo> select(Resultinfo user);
    //查询是否重复
    @Select("select * from  userserinfo ,resultinfo where  resultId=serId and serId=#{serId}")
    List<Resultinfo> findByUserId(Resultinfo user);
    //通过用户名查询
    @Select("select * from  userserinfo ,resultinfo where  resultId=serId and serName=#{serName}")
    List<Resultinfo> findByUserName(Resultinfo user);
    //通过服务类型查询
    @Select("select * from  userserinfo ,resultinfo where  resultId=serId and serType=#{serType}")
    List<Resultinfo> findByserTyped(UserSerInfo user);
    //通过经理查询
    @Select("select * from  userserinfo ,resultinfo where  resultId=serId and serManager=#{serManager}")
    List<Resultinfo> findByserManager(Resultinfo user);
    //查重
    @Select("select * from  userserinfo ,resultinfo where  serId=resultSerId and resultId=#{resultId}")
    Resultinfo selectByUserId(Resultinfo user);
    //完成修改
    @Update("update resultinfo set resultManager = #{resultManager},resultTimei=#{resultTimei} where resultId=#{resultId}")
    int wanchen(Resultinfo user);
    //删除数据
    @Delete("delete from  resultinfo where resultId=#{resultId} ")
    int del(Resultinfo user);
    @Delete("delete from  userserinfo where serId=#{resultSerId} ")
    int del1(Resultinfo user);

    //查询当前用户申请的服务
    @Select("select * from userserinfo where  serUserNickName=#{serUserNickName}")
    List<UserSerInfo> selectuserser (UserSerInfo ser);

    //根据服务ID查询
    @Select("select * from userserinfo where serId=#{serId}")
    List<UserSerInfo> findBySerId (UserSerInfo ser);

    //根据服务类型
    @Select("select * from userserinfo where serType=#{serType}")
    List<UserSerInfo> findByserType (UserSerInfo ser);

    //根据服务时间
    @Select("select * from userserinfo where serTime=#{serTime}")
    List<UserSerInfo> findByserTime(UserSerInfo ser);

    //根据服务是否已读
    @Select("select * from userserinfo where serRead=#{serRead}")
    List<UserSerInfo> findByserRead (UserSerInfo ser);

    //根据客户昵称
    @Select("select * from userserinfo where serUserNickName=#{serUserNickName}")
    List<UserSerInfo> findByserUserNick (UserSerInfo ser);

    //根据客户姓名
    @Select("select * from userserinfo where serName=#{serName}")
    List<UserSerInfo> findByserUserName (UserSerInfo ser);

    //根据服务时间
    @Select("select * from userserinfo where serSpendTime=#{serSpendTime}")
    List<UserSerInfo> findByserRSpend (UserSerInfo ser);

    //根据服务ID查询
    @Select("select * from userserinfo where serId=#{serId}")
    UserSerInfo selectByserId (UserSerInfo ser);

    //修改
    @Update("update userserinfo set serType=#{serType},serTime=#{serTime},serUserTel=#{serUserTel},serSpendMoney=#{serSpendMoney},serSpendTime=#{serSpendTime},serContent=#{serContent},serRead=#{serRead} where serId=#{serId}")
    int upService(UserSerInfo ser);

    //删除服务delservice
    @Delete("delete from userserinfo where serId=#{serId}")
    int delservice(UserSerInfo ser);

    //插入新增服务
    @Insert("insert into userserinfo (serUserNickName,serType,serTime,serName,serUserTel,serSpendMoney,serSpendTime,serContent,serManager,serRead) value (#{serUserNickName},#{serType},#{serTime},#{serName},#{serUserTel},#{serSpendMoney},#{serSpendTime},#{serContent},#{serManager},#{serRead})")
    int serveadd(UserSerInfo ser);

    //查询当前经理收到的所有服务请求selectresilt
    @Select("select * from userserinfo where serManager=#{serManager}")
    List<UserSerInfo> selectresilt(UserSerInfo ser);

    //根据服务ID查询
    @Select("select * from userserinfo where serId=#{serId} and serManager=#{serManager}")
    List<UserSerInfo> serfindBySerId (UserSerInfo ser);

    //根据服务类型
    @Select("select * from userserinfo where serType=#{serType} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserType (UserSerInfo ser);

    //根据服务时间
    @Select("select * from userserinfo where serTime=#{serTime} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserTime(UserSerInfo ser);

    //根据服务是否已读
    @Select("select * from userserinfo where serRead=#{serRead} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserRead (UserSerInfo ser);

    //根据客户昵称
    @Select("select * from userserinfo where serUserNickName=#{serUserNickName} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserUserNick (UserSerInfo ser);

    //根据客户姓名
    @Select("select * from userserinfo where serName=#{serName} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserUserName (UserSerInfo ser);

    //根据服务时间
    @Select("select * from userserinfo where serSpendTime=#{serSpendTime} and serManager=#{serManager}")
    List<UserSerInfo> serfindByserRSpend (UserSerInfo ser);
}
